package org.hhf;

import org.hhf.cronix.TaskScheduler;
import org.hhf.cronix.concurrent.ConcurrentTaskScheduler;
import org.hhf.cronix.support.CronTrigger;

import java.util.Date;

/**
 * Hello world!
 *
 */
public class App {
    public static void main( String[] args ) {
        TaskScheduler taskScheduler = new ConcurrentTaskScheduler();
        taskScheduler.schedule(getRunnable("啦啦啦"), getTrigger());
    }

    private static CronTrigger getTrigger() {
        return new CronTrigger("0/1 * * * * ?");
    }

    private static Runnable getRunnable(String message) {
        return () -> System.out.println(new Date()+" Runnable Task with "+message
                +" on thread "+Thread.currentThread().getName());
    }
}
